﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FA_Server
{
    class Log4net
    {

        // Fields
        //public static ILog log_DAC;
        //public static ILog log_EXP;

        // Methods
        public static void LoadConfig(string str_path)
        {
            //try
            //{
            //    if ((log_DAC == null) || (log_EXP == null))
            //    {
            //        LogManager.ResetConfiguration();
            //        XmlConfigurator.ConfigureAndWatch(new FileInfo(str_path));
            //        log_DAC = LogManager.GetLogger("Logger_DAC");
            //        log_EXP = LogManager.GetLogger("Logger_EXP");
            //    }
            //}
            //catch (Exception exception)
            //{
            //    throw new Exception("加载日志配置文件发生错误!", exception);
            //}
        }

        public static void WriteDACLog(string str_content)
        {
            //try
            //{
            //    string name = "";
            //    string code = "";
            //    if (ContextHelper.LoginContext != null)
            //    {
            //        LoginContext loginContext = ContextHelper.LoginContext;
            //        if (loginContext.CurrentUser != null)
            //        {
            //            name = loginContext.CurrentUser.Name;
            //            code = loginContext.CurrentUser.Code;
            //        }
            //    }
            //    string str3 = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString();
            //    str_content = "<$S>\r\n[时间:" + str3 + "] [用户:" + name + "(" + code + ")] \r\n" + str_content + "\r\n<$E>\r\n";
            //    log_DAC.Debug(str_content);
            //}
            //catch (Exception exception)
            //{
            //    throw new Exception("写入DAC日志发生错误!", exception);
            //}
        }

        public static void WriteEXPLog(string str_content)
        {
            //try
            //{
            //    string name = "";
            //    string code = "";
            //    if (ContextHelper.LoginContext != null)
            //    {
            //        LoginContext loginContext = ContextHelper.LoginContext;
            //        if (loginContext.CurrentUser != null)
            //        {
            //            name = loginContext.CurrentUser.Name;
            //            code = loginContext.CurrentUser.Code;
            //        }
            //    }
            //    string str3 = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString();
            //    str_content = "<$S>\r\n[时间:" + str3 + "] [用户:" + name + "(" + code + ")] \r\n" + str_content + "\r\n<$E>\r\n";
            //    log_EXP.Debug(str_content);
            //}
            //catch (Exception exception)
            //{
            //    throw new Exception("写入EXP日志发生错误!", exception);
            //}
        }
    }
}
